// 数组里面对象包含字符串和数字的升序排序
const arr = [{name:'petter',age:18},{name:'lisa', age:20},{name:'alia', age:18},{name:'rude', age:23}]
const newArr = arr.sort((a, b) => {
    if(a.age === b.age) {
        console.log('aaa', a.name[0]);
        return (a.name.substr(0, 1)).charCodeAt() - (b.name.substr(0, 1)).charCodeAt()
    }
    else {
        return a.age - b.age
    }
})
console.log(newArr);
//charCodeAt() 返回字符串第一个字符的 Unicode 编码(H 的 Unicode 值):